package com.hs.service;

import com.hs.dao.ClassLessonIssueMapper;
import com.hs.entity.ClassLessonIssue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
@Service
@Slf4j
public class ClassLessonIssueService {
    @Autowired
    ClassLessonIssueMapper classLessonIssueMapper;
    @Transactional
    public int insertSelective(ClassLessonIssue record){
        record.setCreateTime(new Date());
        int i = classLessonIssueMapper.insertSelective(record);
        if(i == 0){
            throw new RuntimeException("用户插入失败");
        }
        //初始化用户的物品持有列表
        return  i;
    };
    public List<ClassLessonIssue> selectByCondition(ClassLessonIssue record){
        return classLessonIssueMapper.selectByCondition(record);
    }
    public ClassLessonIssue selectByPrimaryKey(Integer id){
        return classLessonIssueMapper.selectByPrimaryKey(id);
    }






}
